package com.lee.forum.common;

import com.lee.forum.services.IArticleTopCacheService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class MyScheduler {
    @Resource
    private IArticleTopCacheService iArticleTopCacheService;

    @Scheduled(fixedDelay = 60000) // 一秒钟后触发任务，单位为毫秒
    public void runTask() {
        // 定时任务的逻辑代码
        iArticleTopCacheService.refreshTopRedis();
    }
}

